/**
 * 
 */
package number;

import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Locale;

/**
 * @author Student
 *
 */
public class NumberFormaterDemo {

	/**
	 * @param args
	 * @throws ParseException 
	 */
	public static void main(String[] args) throws ParseException {
			
		NumberFormat numberFormater = NumberFormat.getNumberInstance(Locale.US);
		String number = "12,3.01";
		Number parsed1 = (Number) numberFormater.parse(number);
		String number2 = "121,001.01";
		Number parsed2 = (Number) numberFormater.parse(number2);
		System.out.println(parsed1);
		System.out.println(parsed2);
		Number sum = parsed1.doubleValue() + parsed2.doubleValue();
		System.out.println(sum);
		System.out.println("Formated: " + numberFormater.format(sum));
		
	}
}
